import Vue from "vue";
import VueRouter from "vue-router";
import login from "../components/login.vue";
import index from "../components/index.vue"
import userlist from "../components/userlist.vue"
import useradd from "../components/useradd.vue"
import home from "../components/home.vue"
Vue.use(VueRouter);

const routes = [
  {
    path: "/login",
    name: "login",
    component: login
  },
  {
    path: "/",
    name: "index",
    component: index,
    children: [
      {
        path: "",
        name: "home",
        component: home
      },
      {
        path: "/userlist",
        name: "userlist",
        component: userlist
      },
      {
        path: "/useradd",
        name: "useradd",
        component: useradd
      }
    ]
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
